
import axios from 'axios';
export const  baseURL = process.env.VUE_APP_API_BASE_URL;


const service = axios.create({
  baseURL: baseURL,
  headers: {
    'Content-Type': 'application/json; charset=utf-8',
    'X-Requested-With': 'XMLHttpRequest',
  }
})
service.interceptors.request.use(
  config => {
    if (config.method == 'get') {
      config.data = true
    }
    return config
  },
  error => {
    return Promise.reject(error)
  }
)
service.interceptors.response.use(
  response => {
    const res = response.data;
    // 根据需求做统一操作
    return res
  },
  error => {
    return Promise.reject(error)
  }
)

export {
  service
}